$(function(){
	$('.act_edit_profile').click(function(){
		var username=$('.username').val();
		var birthday=$('.birthday').val();
		var act=$('.act').val();
		var sex=$("input[name='sex']:checked").val();
		
		var msg='';
		if (username.length == 0) {
			msg = '用户名不能为空' + '\n';
		}  else if (!username.match(/^[\u4e00-\u9fa5a-z0-9]+$/gi)) {
	        msg = '用户名不能有特殊符号' + '\n';
	    }
		if(msg){
			$('#username_message').html(msg);
		}else{
			$.ajax({
				type : 'post',
				url : '/user/info.html',
				data : {'username':username,'birthday':birthday, 'sex':sex,'act':act},
				async : true,
				success : function(data){
					layer.alert(data.message,function(){location.reload()});
					
				}
			})
		}
	})
	
	
	$('.act_edit_img').click(function(){
		
		var act=$('.act2').val();
		var UpFilePathInfo=$("input[name='UpFilePathInfo']").val();
		if(UpFilePathInfo==null){
			layer.alert('请先上传头像');
			return;
		}else{
			$.ajax({
				type : 'post',
				url : '/user/info.html',
				data : {'UpFilePathInfo':UpFilePathInfo,'act':act},
				async : true,
				success : function(data){
					layer.alert(data.message,function(){location.reload()});
					
				}
			})
		}
	})
})